home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWPat.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.3 KB  |  168 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPat.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPAT_H
  11. #define FWPAT_H
  12.  
  13. #ifndef FWGROBJ_H
  14. #include "FWGrObj.h"
  15. #endif
  16.  
  17. #if defined(FW_BUILD_WIN) && !defined(FWWINDIB_H)
  18. #include "FWWinDIB.h"
  19. #endif
  20.  
  21. // ----- Foundation Includes -----
  22.  
  23. #ifndef FWAUTODE_H
  24. #include "FWAutoDe.h"
  25. #endif
  26.  
  27. #ifndef FWSTDDEF_H
  28. #include "FWStdDef.h"
  29. #endif
  30.  
  31. #if FW_LIB_EXPORT_PRAGMAS
  32. #pragma lib_export on
  33. #endif
  34.  
  35. //========================================================================================
  36. //    Forward Declarations
  37. //========================================================================================
  38.  
  39. class FW_CLASS_ATTR FW_CPatternRep;
  40. class FW_CLASS_ATTR FW_CColor;
  41.  
  42. //========================================================================================
  43. //    typedefs
  44. //========================================================================================
  45.  
  46. union FW_BitPattern
  47.     unsigned char fData[8];
  48.     unsigned long fDataLongs[2];
  49. };
  50.  
  51. union FW_PixelPattern
  52. {
  53.     unsigned char fData[8][8];
  54.     unsigned char fDataRaw[8 * 8];
  55.     unsigned long fDataLongs[8][2];
  56. };
  57.  
  58. #ifdef FW_BUILD_MAC
  59. typedef PixPatHandle            FW_PlatformColorPattern;
  60. #endif
  61. #ifdef FW_BUILD_WIN
  62. typedef FW_CPrivWinDIB::HDIB    FW_PlatformColorPattern;
  63. #endif
  64.  
  65. //========================================================================================
  66. //    CLASS FW_PStyle
  67. //========================================================================================
  68.  
  69. class FW_CLASS_ATTR FW_PPattern : public FW_CGraphicCountedPtr
  70. {
  71. public:
  72.     FW_DECLARE_CLASS
  73.  
  74. public:
  75.     FW_PPattern();
  76.     virtual ~ FW_PPattern();
  77.     
  78.     FW_PPattern(const FW_BitPattern& bits);
  79.     FW_PPattern(const FW_PixelPattern& pixels, short nbColors, const FW_CColor* colorTable);
  80.     FW_PPattern(FW_PlatformColorPattern platformColorPattern);
  81.  
  82.     FW_PPattern(const FW_PPattern& other);
  83.     FW_PPattern& operator=(const FW_PPattern& other);        
  84.     FW_PPattern& operator=(const FW_BitPattern& bits);        
  85.                     
  86.     FW_CPatternRep* operator->();
  87.     const FW_CPatternRep* operator->() const;
  88. };
  89.  
  90. //----------------------------------------------------------------------------------------
  91. //    FW_PPattern::operator->
  92. //----------------------------------------------------------------------------------------
  93. inline FW_CPatternRep* FW_PPattern::operator->()
  94. {
  95.     return (FW_CPatternRep*)GetRep();
  96. }
  97.  
  98. //----------------------------------------------------------------------------------------
  99. //    FW_PPattern::operator->
  100. //----------------------------------------------------------------------------------------
  101. inline const FW_CPatternRep* FW_PPattern::operator->() const
  102. {
  103.     return (const FW_CPatternRep*)GetRep();
  104. }
  105.  
  106. //========================================================================================
  107. //    CLASS FW_CPatternRep
  108. //========================================================================================
  109.  
  110. class FW_CLASS_ATTR FW_CPatternRep : public FW_CGraphicCountedPtrRep
  111. {
  112.     friend class FW_CLASS_ATTR FW_PPattern;
  113.  
  114. public:
  115.     FW_DECLARE_CLASS
  116.  
  117. //----------------------------------------------------------------------------------------
  118. //    Constructors/Destructors
  119. //
  120. protected:
  121.     FW_CPatternRep();
  122.     virtual ~FW_CPatternRep();
  123.  
  124. //----------------------------------------------------------------------------------------
  125. //    Memory management
  126. //
  127. public:
  128.     void*                        operator new(size_t size);
  129.     void                        operator delete(void* p);
  130.  
  131. //----------------------------------------------------------------------------------------
  132. //    New API
  133. //
  134. public:
  135.     virtual FW_PPattern            Copy() const = 0;
  136.  
  137.     virtual FW_Boolean            IsBlack() const = 0;
  138.     
  139.     virtual void                Invert() = 0;
  140.     
  141.     virtual void                FlipHorizontaly() = 0;
  142.     virtual void                FlipVerticaly() = 0;
  143.     
  144.     virtual void                ShiftUp() = 0;
  145.     virtual void                ShiftDown() = 0;
  146.     virtual void                ShiftLeft() = 0;
  147.     virtual void                ShiftRight() = 0;
  148.     
  149. //----------------------------------------------------------------------------------------
  150. //    Platform Specific
  151. //
  152. public:
  153. #ifdef FW_BUILD_MAC
  154.     virtual void                MacSetInCurPort() const = 0;    
  155. #endif
  156.  
  157. #ifdef FW_BUILD_WIN
  158.     virtual HBRUSH                WinCreatePatternBrush() const = 0;    
  159. #endif
  160. };
  161.  
  162. #if FW_LIB_EXPORT_PRAGMAS
  163. #pragma lib_export off
  164. #endif
  165.  
  166. #endif
  167.